<template>
  <div>
    <div id="four"></div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      option: {
        title: {
          text: '总任务量',
          subtext: '总任务量',
          left: 'center'
        },
        tooltip: {
          trigger: 'item',
          formatter: '{a} <br/>{b} : {c} ({d}%)'
        },
        legend: {
          orient: 'vertical',
          left: 'left',
          data: ['张三', '李四', '王二', '小李', '小万', '小赵']
        },
        series: [
          {
            name: '任务量',
            type: 'pie',
            radius: '55%',
            center: ['50%', '60%'],
            data: [
              { value: 335, name: '张三' },
              { value: 310, name: '李四' },
              { value: 234, name: '王二' },
              { value: 135, name: '小李' },
              { value: 1548, name: '小万' },
              { value: 1548, name: '小赵' }
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }
    }
  },
  mounted () {
    this.drawLine()
  },
  methods: {
    drawLine () {
      let myChart = this.$echarts.init(document.getElementById('four'))
      window.onresize = myChart.resize
      myChart.setOption(this.option)
    }
  }
}
</script>
<style scoped>
#four {
  width: 100%;
  height: 350px;
}
</style>